package network;

import java.io.IOException;

import network.messages.AbstractMessage;
import network.messages.PingMessage;
import network.messages.PongMessage;

public class PingListener implements NetworkListener {
    AbstractSocket socket;

    public PingListener(AbstractSocket socket) {
	this.socket = socket;
    }

    @Override
    public void messageArrive(AbstractSocket expediteur, AbstractMessage message) {
	if (message instanceof PingMessage) {
	    PingMessage ping = (PingMessage) message;
	    String buffer = ping.getContenu();
	    this.socket.setBuffer(buffer);
	    this.socket.notify();
		
	}
    }
}